Skip to content

Refactor integration tests for BI Report Server#2432

Merged
johlju merged 6 commits intodsccommunity:mainfrom
johlju:fix/powerbi-integ-tests
Jan 22, 2026
Merged

Refactor integration tests for BI Report Server#2432
johlju merged 6 commits intodsccommunity:mainfrom
johlju:fix/powerbi-integ-tests

Conversation

@johlju
Copy link
Copy Markdown
Member

@johlju johlju commented Jan 22, 2026

Pull Request (PR) description

  • Removed PassThru tests from Enable-SqlDscRsSecureConnection, Initialize-SqlDscRS, Install-SqlDscPowerBIReportServer, Set-SqlDscRSDatabaseConnection, Set-SqlDscRSUrlReservation, Set-SqlDscRSVirtualDirectory.
  • Simplified test setup and teardown processes by eliminating unnecessary original configuration restoration.
  • Updated test URLs to avoid port conflicts.
  • Consolidated test cases for setting URL reservations to ensure multiple URLs can be added and existing ones removed.

These tests are not really relevant as integration tests ad they are mostly tested by unit tests.

This Pull Request (PR) fixes the following issues

Task list

  • Added an entry to the change log under the Unreleased section of the
    file CHANGELOG.md. Entry should say what was changed and how that
    affects users (if applicable), and reference the issue being resolved
    (if applicable).
  • Resource documentation updated in the resource's README.md.
  • Resource parameter descriptions updated in schema.mof.
  • Comment-based help updated, including parameter descriptions.
  • Localization strings updated.
  • Examples updated.
  • Unit tests updated. See DSC Community Testing Guidelines.
  • Integration tests updated (where possible). See DSC Community Testing Guidelines.
  • Code changes adheres to DSC Community Style Guidelines.

This change is Reviewable

…r BI Report Server

- Removed PassThru tests from Enable-SqlDscRsSecureConnection, Initialize-SqlDscRS, Install-SqlDscPowerBIReportServer, Set-SqlDscRSDatabaseConnection, Set-SqlDscRSUrlReservation, Set-SqlDscRSVirtualDirectory.
- Simplified test setup and teardown processes by eliminating unnecessary original configuration restoration.
- Updated test URLs to avoid port conflicts.
- Consolidated test cases for setting URL reservations to ensure multiple URLs can be added and existing ones removed.
@johlju johlju requested a review from a team as a code owner January 22, 2026 16:49
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 22, 2026

Walkthrough

Refactors Reporting Services and Power BI Report Server integration tests: removes BeforeAll/AfterAll state capture/restoration and PassThru verification tests, simplifies URL reservation flows (including port changes), deletes one Power BI post-install stop test, and adds an Unreleased CHANGELOG entry.

Changes

Cohort / File(s) Summary
Changelog
CHANGELOG.md
Added Unreleased "Changed" entry documenting refactor of integration tests for SSRS and Power BI Report Server.
URL reservation tests
tests/Integration/Commands/Add-SqlDscRSUrlReservation.Integration.Tests.ps1, tests/Integration/Commands/Remove-SqlDscRSUrlReservation.Integration.Tests.ps1, tests/Integration/Commands/Set-SqlDscRSUrlReservation.Integration.Tests.ps1
Removed capture/restoration of original URL reservations and BeforeAll/AfterAll scaffolding; changed test ports (e.g., 18081→18080), simplified flows to incremental/single URL additions, and removed PassThru verification cases.
SecureConnection tests
tests/Integration/Commands/Enable-SqlDscRsSecureConnection.Integration.Tests.ps1, tests/Integration/Commands/Disable-SqlDscRsSecureConnection.Integration.Tests.ps1
Removed per-context BeforeAll/AfterAll state capture/restoration and PassThru tests; retained core assertions verifying SecureConnectionLevel changes.
Initialize tests
tests/Integration/Commands/Initialize-SqlDscRS.Integration.Tests.ps1
Removed PassThru verification test for initialized instance; other initialization/restart tests unchanged.
Power BI install tests
tests/Integration/Commands/Install-SqlDscPowerBIReportServer.Integration.Tests.ps1
Deleted test that stopped the Power BI Report Server service after installation; service-running assertion remains.
Database connection tests
tests/Integration/Commands/Set-SqlDscRSDatabaseConnection.Integration.Tests.ps1
Removed PassThru verification tests across contexts; retained non-PassThru validations.
Virtual directory tests
tests/Integration/Commands/Set-SqlDscRSVirtualDirectory.Integration.Tests.ps1
Removed PassThru verification test cases across all contexts; other test logic unchanged.

Sequence Diagram(s)

(omitted — changes are test refactors and do not introduce new multi-component control flow)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Refactor integration tests for BI Report Server' directly summarizes the main change—refactoring integration tests for SQL Server Reporting Services and Power BI Report Server across multiple test files.
Description check ✅ Passed The description is directly related to the changeset, providing clear details about removed PassThru tests, simplified setup/teardown, updated test URLs, and consolidated test cases across the affected integration test files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/Integration/Commands/Set-SqlDscRSUrlReservation.Integration.Tests.ps1 (1)

43-63: Assign unused Set-SqlDscRSUrlReservation outputs to $null.

These calls return objects that aren't used; the test guidelines require assigning unused outputs to $null inside It blocks.

♻️ Example fix (apply similarly to each call)
-            $script:configuration | Set-SqlDscRSUrlReservation -Application 'ReportServerWebService' -UrlString $script:testUrl1, $script:testUrl2 -Force -ErrorAction 'Stop'
+            $null = $script:configuration | Set-SqlDscRSUrlReservation -Application 'ReportServerWebService' -UrlString $script:testUrl1, $script:testUrl2 -Force -ErrorAction 'Stop'
As per coding guidelines, please assign unused outputs to `$null` in `It` blocks.

Also applies to: 65-84, 95-115, 117-136, 147-167, 169-188, 200-220, 222-241

🤖 Fix all issues with AI agents
In
`@tests/Integration/Commands/Remove-SqlDscRSUrlReservation.Integration.Tests.ps1`:
- Line 62: Remove the stray character 's' that appears immediately before the
closing brace on the offending line (it breaks PowerShell parsing); edit the
test block in Remove-SqlDscRSUrlReservation.Integration.Tests.ps1 to delete that
's' so the closing brace '}' stands alone and the script parses correctly.
🧹 Nitpick comments (1)
CHANGELOG.md (1)

10-12: Italicize module/product names per Markdown style guide.

To follow the documentation formatting rules, format module/product names in italic.

♻️ Proposed update
-- SqlServerDsc
-  - Refactor integration tests for SQL Server Reporting Services and Power BI Report
-    Server ([issue `#2431`](https://github.com/dsccommunity/SqlServerDsc/issues/2431)).
+- _SqlServerDsc_
+  - Refactor integration tests for _SQL Server Reporting Services_ and _Power BI
+    Report Server_ ([issue `#2431`](https://github.com/dsccommunity/SqlServerDsc/issues/2431)).

johlju and others added 2 commits January 22, 2026 17:57
…ration.Tests.ps1

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…SQL Server Reporting Services and Power BI Report Server
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@tests/Integration/Commands/Disable-SqlDscRsSecureConnection.Integration.Tests.ps1`:
- Line 72: Remove the stray incomplete token "BeforeA" that was left in the test
file (a truncated remnant of a BeforeAll block) so the PowerShell test script
parses correctly; locate the orphaned "BeforeA" text in
Disable-SqlDscRsSecureConnection.Integration.Tests.ps1 and delete that token (or
restore a proper BeforeAll block if the setup logic was accidentally removed)
ensuring no partial keywords remain.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/Integration/Commands/Set-SqlDscRSUrlReservation.Integration.Tests.ps1 (1)

43-63: Test name says “remove existing ones,” but assertions don’t verify removal.
Right now the tests only assert containment, so they can pass even if old URLs remain. Either rename the test or add an assertion that no extra URLs exist for ReportServerWebService.

✅ Suggested assertion (apply to each context)
             $currentUrls | Should -Contain $script:testUrl1
             $currentUrls | Should -Contain $script:testUrl2
+            $currentUrls | Should -HaveCount 2

As per coding guidelines, integration tests must cover all scenarios and code paths.

Also applies to: 95-115, 147-167, 200-220

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94%. Comparing base (8901e69) to head (7881f57).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #2432   +/-   ##
=====================================
  Coverage     94%     94%           
=====================================
  Files        226     226           
  Lines      11182   11182           
=====================================
  Hits       10545   10545           
  Misses       637     637           
Flag Coverage Δ
unit 94% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@johlju johlju merged commit 18f6ecb into dsccommunity:main Jan 22, 2026
36 checks passed
@johlju johlju deleted the fix/powerbi-integ-tests branch January 22, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant